﻿using System;
using System.Net;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace HTTPUpdateCheckerServer
{
    class Server
    {
        HttpListener listener = new HttpListener();
        public Server(int port)
        {
            listener.Prefixes.Add($"http://127.0.0.1:{port}/api/icu/plugins/");
        }
        public void Start()
        {
            listener.Start();
            new Thread(() =>
            {
                while (listener.IsListening)
                {
                    HttpListenerContext context = listener.GetContext();
                    if (context.Request.Url.AbsolutePath.StartsWith("/plugins/u/"))
                    {
                        switch (context.Request.QueryString["type"])
                        {
                            case "check":

                                break;
                            case "download":
                                break;
                            default:
                                break;
                        }
                    }
                }
            }).Start();
        }
    }
}
